package com.hhs.storage.bean;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hhs.storage.util.SysUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 计划成员
 * </p>
 *
 * @author hhs
 * @since 2023-01-13
 */
@Data
public class ProjectMember implements Serializable {

    private static final long serialVersionUID = 1L;
    public static final Integer IDENTITY_IDENTITY_TYPE_HEADER = 0;
    public static final Integer IDENTITY_IDENTITY_TYPE_HELPERS = 1;
    public static final Integer IDENTITY_IDENTITY_TYPE_SUPERVISOR = 2;
    public static final Integer IDENTITY_IDENTITY_TYPE_EXECUTOR = 3;
    private String id;

    /**
     * 项目计划id
     */
    private String projectId;

    /**
     * 用户id
     */
    private String userId;
    /**
     * 用户名
     */
    @TableField(exist = false)
    private String name;
    @TableField(exist = false)
    private BaseUser user;
    /**
     * 身份类型 0=负责人、1=协助人、2=监督人、3=执行人
     */
    private Integer identityType;
    /**
     * 个人项目进度
     */
    private Integer progress=0;
    /**
     * 个人项目奖金
     */
    private Double personalBonus=0d;
    /**
     * 工作内容
     */
    private String workContent;

    private Integer wkFlag;

    /**
     * 0.无评价 1.良 2.优
     */
    private Integer evaluate;
    /**
     * 同意状态0不同意1同意
     */

    private Integer agreeStatus;

    @JSONField(format="yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate workStartDate;//工作开始时间

    @JSONField(format="yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate workEndDate;//工作结束时间

    /**
     * 创建时间
     */
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @TableField(exist = false)
    private List<PersonalPlan> personalPlanList = new ArrayList<>();

    @TableField(exist = false)
    private List<SubWkFlow> subWkFlow =new ArrayList<>();

    @TableField(exist = false)
    private Integer attC;

    public String getIdentityTypeName() {
        return SysUtil.PROJECT_MEMBER_IDENTITY_TYPE_MAP.get(this.identityType);
    }


}
